/**
 * [OElove] (C)2010-2099 OELOVE.COM Inc.biz
 * Email: service@phpcoo.com ,phpcoo@qq.com
 * This is NOT a freeware, use is subject to license terms
 * $ Last update 2017/04/24 by CL $
*/
$(function(){

	//展开、收起更多...
	$(document).on("click", "[f='but_showmore']", function(){
		$_box = $(this).attr("data-box");
		if ($(this).hasClass("current")) {
			$("#"+$_box+"_more_box").slideUp(100);
			$(this).removeClass("current");
			$(this).html("展开更多<i></i>");
		}
		else {
			$("#"+$_box+"_more_box").slideDown(100);
			$(this).addClass("current");
			$(this).html("收起更多<i></i>");
		}
	});
	
	//打开约TA框
	$(document).on("click", "[f='pop_add_yueta']", function(){
		if (_LOGIN_STATUS == 0) {
			_jdLogin();
			return false;
		}
		else {
			$_touid = $(this).attr("data-touid");
			$width = $(this).attr("data-width");
			if (typeof($width) == "undefined") {
				$width = 600;
			}
			$height = $(this).attr("data-height");
			if (typeof($height) == "undefined") {
				$height = 460;
			}
			$_url = _ROOT_PATH+"index.php?c=home&a=yueta&touid="+$_touid+"&r="+get_rndnum(8);
			oeShadeBox("pop_add_yueta", "ajax", $_url, $width, $height);
		}
	});
	$(document).on("click", "[f='select_radio_s']", function(){
		$_tab = $(this).attr("data-tab");
		$_val = $(this).attr("data-val");
		$("[data-tab='"+$_tab+"']").removeClass("current");
		$(this).addClass("current");
		$("#"+$_tab).val($_val);

		if ($_tab == "redbag") {
			$("#redbag_tips").hide();
		}
	});
	//其他金额
	$(document).on("click", "[f='other_redbag']", function(){
		$("[data-tab='redbag']").removeClass("current");
		$("#redbag_tips").show();
		//$("#redbag_select").hide();
	});

	//范围选择
	$(document).on("click", "[f='select_range']", function(){
		if ($(this).parent().parent().find("div").last().css("display") == "none") {
			$(this).parent().parent().parent().parent().addClass("current");
			$(this).parent().parent().find("div").last().show();
		}
		else {
			$(this).parent().parent().parent().parent().removeClass("current");
			$(this).parent().parent().find("div").last().hide();
		}
	});
	//确定选择
	$(document).on("click", "[f='confirm_range']", function(){
		$_tab1 = $(this).attr("data-1");
		$_tab2 = $(this).attr("data-2");
		$_unit = $(this).attr("data-unit");
		if (typeof($_unit) == "undefined") {
			$_unit = "";
		}
		$_text = "";

		$_val1 = $("#"+$_tab1).val();
		if (typeof($_val1) == "undefined") {
			$_val1 = "";
		}
		$_text1 = $("#"+$_tab1).find("option:selected").text();
		if ($_text1 == "请选择") {
			$_text1 = "";
		}

		$_val2 = $("#"+$_tab2).val();
		if (typeof($_val2) == "undefined") {
			$_val2 = "";
		}
		$_text2 = $("#"+$_tab2).find("option:selected").text();
		if ($_text2 == "请选择") {
			$_text2 = "";
		}
		if ($_text1.length > 0 && $_text2.length > 0) {
			$_text = $_text1+"-"+$_text2+$_unit;
		}
		if ($_text.length == 0) {
			$_text = "请选择";
		}

		$(this).parent().parent().hide();
		$(this).parent().parent().parent().find("div").first().find("span").html($_text+"<em></em>");
		$(this).parent().parent().parent().parent().parent().removeClass("current");

	});

	//点击保存约TA
	$(document).on("click", "[f='but_save_addyueta']", function(){
		$_touid = $(this).attr("data-touid");
		$endtimes = $("#endtimes").val();
		$area1 = $("#area1").val();
		$area2 = $("#area2").val();
		if (typeof($area2) == "undefined") {
			$area2 = 0;
		}
		$yuetades = $("#yuetades").val();
		$redbag = $("#redbag").val();

		if ($endtimes.length == 0) {
			ToastShow("请选择有效时间");
			return false;
		}
		if ($area1.length == 0) {
			ToastShow("请选择约会城市");
			return false;
		}
		if ($yuetades.length == 0) {
			ToastShow("请填写约会安排");
			return false;
		}

		$.ajax({
			type: "POST",
			url: _ROOT_PATH+"index.php?c=home",
			cache: false,
			data: {
				a:"saveyueta", homeuid:$_touid, endtimes:$endtimes, area1:$area1, area2:$area2, 
				yuetades:$yuetades, redbag:$redbag, datatype:"json", r:get_rndnum(8)
			},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				if ($response == "1") {
					if ($result.length > 0) {
						window.location.href = _ROOT_PATH+"index.php?c=pay&paynum="+$result;
					}
					else {
						ToastShow("邀请成功，请等待对方回应");
						_closeShadeBox("pop_add_yueta", function(){
							$("[f='pop_add_yueta']").addClass("current");
							$("[f='pop_add_yueta']").html("<i></i>已发邀请");
							$("[f='pop_add_yueta']").attr("data-touid", "");
						});
					}
				}
				else {
					if ($result.length > 0) {
						ToastShow($result);
					}
					else {
						ToastShow("操作失败");
					}
				}
			},
			error: function() {
				ToastShow("系统繁忙，请稍后再试");
			}
		});

	});


	//打开资料完善度提醒
	$(document).on("click", "[f='but_open_profile_tips']", function(){
		$("html").addClass("dialog_lock_hide");
		$("#profile_power_box").show();
		$("#profile_power_data").yanVhSlideSide(100, function(){
			$("#profile_power_close").show();
		});
	});
	//关闭资料完善度提醒
	$(document).on("click", "[f='but_close_profile_tips']", function(){
		$("#profile_power_close").hide();
		$("#profile_power_data").yanVhSlideCenter(100, function(){
			$("#profile_power_box").hide();
			$("html").removeClass("dialog_lock_hide"); //滚动条
		});
	});

	//发送邀请上传照片提醒
	$(document).on("click", "[f='but_send_photomsg']", function(){
		if (_LOGIN_STATUS == 0) {
			_jdLogin();
			return false;
		}
		$_touid = $(this).attr("data-touid");
		if (typeof($_touid) == "undefined") {
			$_touid = "";
		}
		if ($_touid.length > 0) {
			$.ajax({
				type: "POST",
				url: _ROOT_PATH+"index.php?c=home",
				cache: false,
				data: {a:"sendphotomsg", touid:$_touid, datatype:"json", r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						ToastShow("邀请发送成功");
						$("[f='but_send_photomsg']").html("已发上传提醒");
						$("[f='but_send_photomsg']").attr("data-touid", "");
						$("[f='but_send_photomsg']").addClass("current");
					}
					else {
						if ($result.length > 0) {
							ToastShow($result);
						}
						else {
							ToastShow("邀请发送失败");
						}
					}
				},
				error: function() {
					ToastShow("系统繁忙，请稍后再试");
				}
			});
		}
	});
	//发送录制语音独白提醒
	$(document).on("click", "[f='but_send_soundmsg']", function(){
		if (_LOGIN_STATUS == 0) {
			_jdLogin();
			return false;
		}
		$_touid = $(this).attr("data-touid");
		if (typeof($_touid) == "undefined") {
			$_touid = "";
		}
		if ($_touid.length > 0) {
			$.ajax({
				type: "POST",
				url: _ROOT_PATH+"index.php?c=home",
				cache: false,
				data: {a:"sendsoundmsg", touid:$_touid, datatype:"json", r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						ToastShow("提醒发送成功");
						$("[f='but_send_soundmsg']").html("已发录制提醒");
						$("[f='but_send_soundmsg']").attr("data-touid", "");
						$("[f='but_send_soundmsg']").addClass("current");
					}
					else {
						if ($result.length > 0) {
							ToastShow($result);
						}
						else {
							ToastShow("提醒发送失败");
						}
					}
				},
				error: function() {
					ToastShow("系统繁忙，请稍后再试");
				}
			});
		}

	});



	//操作点赞
	$(document).on("click", "[f='but_dozan']", function(){
		if (_LOGIN_STATUS == 0) {
			_jdLogin();
			return false;
		}
		else {
			$_type = $(this).attr("data-type");
			$_id = $(this).attr("data-id");
			$this_obj = $(this);
			$.ajax({
				type: "POST",
				url: _ROOT_PATH+"index.php?c=home",
				cache: false,
				data: {a:"zan", type:$_type, id:$_id, datatype:"json", r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						$this_obj.addClass("current");
						$(".hudong span").attr("f", "");
						$(".hudong label").attr("f", "");
						ToastShow("操作成功");
						_get_home_defen($_id);
					}
					else {
						if ($result.length > 0) {
							ToastShow($result);
						}
						else {
							ToastShow("操作失败");
						}
					}
				},
				error: function() {
					ToastShow("系统繁忙，请稍后再试");
				}
			});
		}
	});

	
	//打开公开相册
	$(document).on("click", "[f='but_open_public_photozoom']", function(){
		if (_LOGIN_STATUS == 0) {
			_jdLogin();
			return false;
		}
		$_photo_id = $(this).attr("data-id"); //当前photo id
		$_uid = $(this).attr("data-uid"); //会员UID
		$("body").append("<div class='page_loading' style='display:block;' id='ajax_loading'><span></span></div>");
		$("html").addClass("dialog_lock_hide");
		$.ajax({
			type: "POST",
			url: _ROOT_PATH+"index.php?c=home",
			cache: false,
			data: {a:"photozoom", id:$_photo_id, uid:$_uid, datatype:"json", r:get_rndnum(8)},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				if ($response == "1") {
					$("#photo_zoom_data").html($result);
					$("#photo_zoom_box").fadeIn(100, function(){
						$("html").addClass("dialog_lock_hide");
					});
				}
				else {
					if ($result.length > 0) {
						ToastShow($result);
					}
					else {
						ToastShow("获取数据失败");
					}
				}
				$("#ajax_loading").remove();
			},
			error: function() {
				ToastShow("系统繁忙，请稍后再试");
			}
		});
	});
	//关闭图片放大
	$(document).on("click", "[f='but_close_public_photozoom']", function(){
		$("#photo_zoom_box").fadeOut(100, function(){
			$("#photo_zoom_data").html("");
			$("html").removeClass("dialog_lock_hide");
		});
	});
	//公开相册 上一张
	$(document).on("click", "[f='but_prev_photo']", function(){
		$zoom_nums = parseInt($("#zoom_nums").val()); //张数
		$orderi = parseInt($("#orderi").val()); //当前
		$prev_orderi = 0;
		if ($orderi > 1) {
			$prev_orderi = ($orderi-1);
		}
		else {
			$prev_orderi = $zoom_nums;
		}		
		if ($prev_orderi > 0) {
			$("#zoom_orderi").html($prev_orderi);
			$("#orderi").val($prev_orderi);
			
			$("#zoom_list ._list").hide();
			$("#zoom_"+$prev_orderi).show();

			$_photoid = $("#zoom_"+$prev_orderi).attr("data-photoid");
			$_zans = $("#zoom_"+$prev_orderi).attr("data-zans");
			$("#zoom_photoid").val($_photoid);
			$("#zans_tg").html($_zans);
		}

	});
	
	//公开相册 下一张
	$(document).on("click", "[f='but_next_photo']", function(){
		$zoom_nums = parseInt($("#zoom_nums").val()); //张数
		$orderi = parseInt($("#orderi").val()); //当前
		$next_orderi = 0;
		if ($orderi < $zoom_nums) {
			$next_orderi = ($orderi+1);
		}
		else {
			$next_orderi = 1;
		}
		if ($next_orderi > 0) {
			$("#zoom_orderi").html($next_orderi);
			$("#orderi").val($next_orderi);

			$("#zoom_list ._list").hide();
			$("#zoom_"+$next_orderi).show();

			$_photoid = $("#zoom_"+$next_orderi).attr("data-photoid");
			$_zans = $("#zoom_"+$next_orderi).attr("data-zans");
			$("#zoom_photoid").val($_photoid);
			$("#zans_tg").html($_zans);
		}

	});

	/*-------------------- view contact Begin ---------------------*/
	//打开查看联系方式
	$(document).on("click", "[f='but_open_viewcontact']", function(){
		if (_LOGIN_STATUS == 0) {
			_jdLogin();
			return false;
		}
		else {

			$_id = $(this).attr("data-uid");
			$("html").addClass("dialog_lock_hide");
			$("body").append("<div class='page_loading' style='display:block;' id='ajax_loading'><span></span></div>");
			$.ajax({
				type: "POST",
				url: _ROOT_PATH + "index.php?c=view",
				cache: false,
				data: {a:"contact", id:$_id, datatype:"json", r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						$("#viewcontact_data").html($result);
						$("#viewcontact_box").show();
						$("#viewcontact_data").slideDown(JS_FADEIN_TIME, function(){
							
						});
					}
					else {
						if ($result.length > 0) {
							ToastShow($result);
						}
						else {
							ToastShow("获取数据失败");
						}
					}
					$("#ajax_loading").remove();
				},
				error: function() {
					ToastShow("系统繁忙，请稍后再试");
				}
			});
		}
	});
	//关闭查看联系方式
	$(document).on("click", "[f='but_close_viewcontact']", function(){
		$("#viewcontact_data").slideUp(JS_FADEOUT_TIME, function(){
			$("#viewcontact_box").hide();
			$("html").removeClass("dialog_lock_hide");
		});
	});
	//打开联系方式-付费方式
	$(document).on("click", "[f='but_open_viewcontact_pay']", function(){
		/*
		$("#viewcontact_pay_box").show();
		//$("#viewcontact_pay_data").slideDown(JS_FADEIN_TIME);

		$_height = parseInt($("#viewcontact_pay_data").height());
		$_css_height = ($_height)/2;
		$("#viewcontact_pay_data").css({"margin-top":"-"+$_css_height+"px", "top":"50%"});
		$("#viewcontact_pay_data").slideDown(JS_FADEIN_TIME);
		*/


		$_home_uid = $(this).attr("data-id");
		$_url = _ROOT_PATH+"index.php?c=view&a=contactpayment&id="+$_home_uid+"&r="+get_rndnum(8);
		oeShadeBox("pop_pay_viewcontact", "ajax", $_url, 690, 500);

	});
	//关闭联系方式-付费方式
	/*
	$(document).on("click", "[f='but_close_viewcontact_pay']", function(){
		$("#viewcontact_pay_data").slideUp(JS_FADEOUT_TIME, function(){
			$("#viewcontact_pay_box").hide();
		});
	});
	*/

	$(document).on("click", "[f='sel_contact_payment']", function(){
		$("._list_pay ul li").removeClass("current");
		$(this).addClass("current");
		$_sdkid = $(this).attr("data-sdkid");
		$_sdkname = $(this).attr("data-sdkname");
		$("[f='but_viewcontact_confirmpay']").attr("data-sdkid", "");
		$("[f='but_viewcontact_confirmpay']").attr("data-sdkid", $_sdkid);
	});

	//确定支付
	$(document).on("click", "[f='but_viewcontact_confirmpay']", function(){
		$_id = $(this).attr("data-uid");
		$_sdkid = $(this).attr("data-sdkid");
		if ($_sdkid.length == 0) {
			ToastShow("请选择付款方式");
			return false;
		}
	
		$("body").append("<div class='page_loading' style='display:block;' id='ajax_loading'><span></span></div>");
		$.ajax({
			type: "POST",
			url: _ROOT_PATH + "index.php?c=view",
			cache: false,
			data: {a:"paycontact", id:$_id, sdkid:$_sdkid, datatype:"json", r:get_rndnum(8)},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				if ($response == "1") {
					if ($result.length > 0) { //在线支付
						window.location.href = _ROOT_PATH+"index.php?c=pay&a=submit&paynum="+$result;
					}
					else { //重新加载
						$("#ajax_loading").remove();
						ToastShow("支付成功");
						$.ajax({
							type: "POST",
							url: _ROOT_PATH + "index.php?c=view",
							cache: false,
							data: {a:"contact", id:$_id, datatype:"json", r:get_rndnum(8)},
							dataType: "json",
							success: function($data) {
								$json = eval($data);
								$response = $json.response;
								$result = $json.result;
								if ($response == "1") {
									$("#viewcontact_data").html($result);

									//关闭支付方式
									_closeShadeBox("pop_pay_viewcontact");
									/*
									$("#viewcontact_pay_data").slideUp(JS_FADEOUT_TIME, function(){
										$("#viewcontact_pay_box").hide();
									});
									*/

								}
							},
							error: function() {
							}
						});
					}
					
				}
				else {
					$("#ajax_loading").remove();
					if ($result.length > 0) {
						ToastShow($result);
					}
					else {
						ToastShow("支付失败");
					}
				}
				
			},
			error: function() {
				ToastShow("系统繁忙，请稍后再试");
			}
		});
	});
	/*---------------------- view contact End --------------------*/


	/*-------------------- view photo Begin ---------------------*/
	//打开查看私密照
	$(document).on("click", "[f='but_open_viewphoto']", function(){
		if (_LOGIN_STATUS == 0) {
			_jdLogin();
			return false;
		}
		else {
			$_id = $(this).attr("data-uid");
			$("html").addClass("dialog_lock_hide");
			$("body").append("<div class='page_loading' style='display:block;' id='ajax_loading'><span></span></div>");
			$.ajax({
				type: "POST",
				url: _ROOT_PATH + "index.php?c=view",
				cache: false,
				data: {a:"photo", id:$_id, datatype:"json", r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						$("#viewphoto_data").html($result);
						$("#viewphoto_box").show();
						$("#viewphoto_data").fadeIn(JS_FADEIN_TIME);
					}
					else {
						if ($result.length > 0) {
							ToastShow($result);
						}
						else {
							ToastShow("获取数据失败");
						}
					}
					$("#ajax_loading").remove();
				},
				error: function() {
					ToastShow("系统繁忙，请稍后再试");
				}
			});
		}
	});
	//关闭查看私密照
	$(document).on("click", "[f='but_close_viewphoto']", function(){
		$("#viewphoto_data").fadeIn(JS_FADEOUT_TIME, function(){
			$("#viewphoto_data").html("");
			$("#viewphoto_box").hide();
			$("html").removeClass("dialog_lock_hide");
		});
	});
	//打开私密照-付费方式
	$(document).on("click", "[f='but_open_viewphoto_pay']", function(){
		/*
		$("#viewphoto_pay_box").show();
		//$("#viewphoto_pay_data").slideDown(JS_FADEIN_TIME);
		$_height = parseInt($("#viewphoto_pay_data").height());
		$_css_height = ($_height)/2;
		$("#viewphoto_pay_data").css({"margin-top":"-"+$_css_height+"px", "top":"50%"});
		$("#viewphoto_pay_data").slideDown(JS_FADEIN_TIME);
		*/
		$_home_uid = $(this).attr("data-id");
		$_url = _ROOT_PATH+"index.php?c=view&a=photopayment&id="+$_home_uid+"&r="+get_rndnum(8);
		oeShadeBox("pop_pay_viewphoto", "ajax", $_url, 690, 500);
	});
	//关闭私密照-付费方式
	$(document).on("click", "[f='but_close_viewphoto_pay']", function(){
		$("#viewphoto_pay_data").slideUp(JS_FADEOUT_TIME, function(){
			$("#viewphoto_pay_box").hide();
		});
	});
	$(document).on("click", "[f='sel_photo_payment']", function(){
		$("._list_pay ul li").removeClass("current");
		$(this).addClass("current");
		$_sdkid = $(this).attr("data-sdkid");
		$_sdkname = $(this).attr("data-sdkname");
		$("[f='but_viewphoto_confirmpay']").attr("data-sdkid", "");
		$("[f='but_viewphoto_confirmpay']").attr("data-sdkid", $_sdkid);
	});


	//选择支付方式
	$(document).on("click", "[f='but_viewphoto_confirmpay']", function(){
		$_id = $(this).attr("data-uid");
		$_sdkid = $(this).attr("data-sdkid");
		if ($_sdkid.length == 0) {
			ToastShow("请选择付款方式");
			return false;
		}
		$("body").append("<div class='page_loading' style='display:block;' id='ajax_loading'><span></span></div>");
		$.ajax({
			type: "POST",
			url: _ROOT_PATH + "index.php?c=view",
			cache: false,
			data: {a:"payphoto", id:$_id, sdkid:$_sdkid, datatype:"json", r:get_rndnum(8)},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				if ($response == "1") {
					if ($result.length > 0) { //在线支付
						window.location.href = _ROOT_PATH+"index.php?c=pay&a=submit&paynum="+$result;
					}
					else { //重新加载
						$("#ajax_loading").remove();
						ToastShow("支付成功");
						$.ajax({
							type: "POST",
							url: _ROOT_PATH + "index.php?c=view",
							cache: false,
							data: {a:"photo", id:$_id, datatype:"json", r:get_rndnum(8)},
							dataType: "json",
							success: function($data) {
								$json = eval($data);
								$response = $json.response;
								$result = $json.result;
								if ($response == "1") {
									$("#viewphoto_data").html("");
									$("#viewphoto_data").html($result);
									//关闭支付方式
									_closeShadeBox("pop_pay_viewphoto");
									/*
									$("#viewphoto_pay_data").slideUp(JS_FADEOUT_TIME, function(){
										$("#viewphoto_pay_box").hide();
									});
									*/
								}
							},
							error: function() {
							}
						});
					}
					
				}
				else {
					$("#ajax_loading").remove();
					if ($result.length > 0) {
						ToastShow($result);
					}
					else {
						ToastShow("支付失败");
					}
				}
				
			},
			error: function() {
				ToastShow("系统繁忙，请稍后再试");
			}
		});
	});

	//私密照 上一张
	$(document).on("click", "[f='but_prev_viewphoto']", function(){
		$zoom_nums = parseInt($("#pr_zoom_nums").val()); //张数
		$orderi = parseInt($("#pr_orderi").val()); //当前
		$prev_orderi = 0;
		if ($orderi > 1) {
			$prev_orderi = ($orderi-1);
		}
		else {
			$prev_orderi = $zoom_nums;
		}
		if ($prev_orderi > 0) {
			$("#pr_zoom_orderi").html($prev_orderi);
			$("#pr_orderi").val($prev_orderi);
			
			$("#pr_zoom_list ._list").hide();
			$("#pr_zoom_"+$prev_orderi).show();

			$_photoid = $("#pr_zoom_"+$prev_orderi).attr("data-photoid");
			$_zans = $("#pr_zoom_"+$prev_orderi).attr("data-zans");
			$("#pr_zoom_photoid").val($_photoid);
			$("#pr_zans_tg").html($_zans);
		}

	});
	
	//私密照 下一张
	$(document).on("click", "[f='but_next_viewphoto']", function(){
		$zoom_nums = parseInt($("#pr_zoom_nums").val()); //张数
		$orderi = parseInt($("#pr_orderi").val()); //当前
		$next_orderi = 0;
		if ($orderi < $zoom_nums) {
			$next_orderi = ($orderi+1);
		}
		else {
			$next_orderi = 1;
		}
		if ($next_orderi > 0) {
			$("#pr_zoom_orderi").html($next_orderi);
			$("#pr_orderi").val($next_orderi);

			$("#pr_zoom_list ._list").hide();
			$("#pr_zoom_"+$next_orderi).show();

			$_photoid = $("#pr_zoom_"+$next_orderi).attr("data-photoid");
			$_zans = $("#pr_zoom_"+$next_orderi).attr("data-zans");
			$("#pr_zoom_photoid").val($_photoid);
			$("#pr_zans_tg").html($_zans);
		}

	});

	/*---------------------- view photo End --------------------*/
	

	$(document).on("click", "[f='but_hudong']", function(){
		if ($("#hudong_data").css("display") == "block") {
			$("#hudong_data").slideUp(100);
		}
		else {
			$("#hudong_data").slideDown(100);
		}
	});
	//发送加好友申请
	$(document).on("click", "[f='but_add_friend']", function(){
		if (_LOGIN_STATUS == 0) {
			_jdLogin();
			return false;
		}
		else {
			$_id = $(this).attr("data-id");
			$.ajax({
				type: "POST",
				url: _ROOT_PATH + "index.php?c=home",
				cache: false,
				data: {a:"apply", id:$_id, datatype:"json", r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						$("[f='but_add_friend']").addClass("current");
						$("[f='but_add_friend']").html("<i></i>已发好友申请");
						$("[f='but_add_friend']").attr("f", "");
						ToastShow("操作成功");
					}
					else {
						if ($result.length > 0) {
							ToastShow($result);
						}
						else {
							ToastShow("操作失败");
						}
					}
				},
				error: function() {
					ToastShow("系统繁忙，请稍后再试");
				}
			});
		}
	});

	//加入关注
	$(document).on("click", "[f='but_add_listen']", function(){
		if (_LOGIN_STATUS == 0) {
			_jdLogin();
			return false;
		}
		else {
			$_id = $(this).attr("data-id");
			$.ajax({
				type: "POST",
				url: _ROOT_PATH + "index.php?c=home",
				cache: false,
				data: {a:"addlisten", id:$_id, datatype:"json", r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						$("[f='but_add_listen']").html("<i class='icon_2'></i>已加关注");
						$("[f='but_add_listen']").attr("f", "");
						ToastShow("操作成功");
					}
					else {
						if ($result.length > 0) {
							ToastShow($result);
						}
						else {
							ToastShow("操作失败");
						}
					}
				},
				error: function() {
					ToastShow("系统繁忙，请稍后再试");
				}
			});
		}
	});

	//取消关注
	$(document).on("click", "[f='but_del_listen']", function(){
		if (_LOGIN_STATUS == 0) {
			_jdLogin();
			return false;
		}
		else {
			$_id = $(this).attr("data-id");
			$.ajax({
				type: "POST",
				url: _ROOT_PATH + "index.php?c=home",
				cache: false,
				data: {a:"dellisten", id:$_id, datatype:"json", r:get_rndnum(8)},
				dataType: "json",
				success: function($data) {
					$json = eval($data);
					$response = $json.response;
					$result = $json.result;
					if ($response == "1") {
						$("[f='but_del_listen']").html("<i class='icon_2'></i>已取消关注");
						$("[f='but_del_listen']").attr("f", "");
						ToastShow("操作成功");
					}
					else {
						if ($result.length > 0) {
							ToastShow($result);
						}
						else {
							ToastShow("操作失败");
						}
					}
				},
				error: function() {
					ToastShow("系统繁忙，请稍后再试");
				}
			});
		}
	});

	//诚信查询 7.04.20
	$(document).on("click", "[f='but_home_viewcredit']", function(){
		$home_uid = $(this).attr("data-uid");
		$("#credit_loading").show();
		$.ajax({
			type: "POST",
			url: _ROOT_PATH + "index.php?c=home",
			cache: false,
			data: {a:"viewcredit", id:$home_uid, datatype:"json", r:get_rndnum(8)},
			dataType: "json",
			success: function($data) {
				$json = eval($data);
				$response = $json.response;
				$result = $json.result;
				$("#credit_loading").hide();
				if ($response == "1") {
					$("#credit_result").html($result).show();
					$("[f='but_close_viewcredit']").show();
				}
				else {
					if ($result.length > 0) {
						ToastShow($result);
					}
					else {
						ToastShow("查询失败，请联系客服");
					}
				}
			},
			error: function() {
				ToastShow("系统繁忙，请稍后再试");
			}
		});

	});
	//关闭诚信查询结果 7.04.24
	$(document).on("click", "[f='but_close_viewcredit']", function(){
		$("#credit_result").hide();
		$("[f='but_close_viewcredit']").hide();
	});
	

});

//获取得分信息
function _get_home_defen($uid) {
	$.ajax({
		type: "POST",
		url: _ROOT_PATH + "index.php?c=home",
		cache: false,
		data: {a:"defen", id:$uid, datatype:"json", r:get_rndnum(8)},
		dataType: "json",
		success: function($data) {
			$json = eval($data);
			$response = $json.response;
			$result = $json.result;
			if ($response == "1") {
				$("#dafen_json").html($result);
			}
			else {
			}
		},
		error: function() {
		}
	});
}
